package com.dhcc.logs.common.utils;

import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;

public class ModelMapperSingle {
    protected final static ModelMapper modelMapper = new ModelMapper();
    private final static ModelMapperSingle modelMapperSingle = new ModelMapperSingle();

    static {
        modelMapper.getConfiguration().setFullTypeMatchingRequired(true);
        //匹配策略:严格匹配源和目标属性
        //        MatchingStrategies.STANDARD	智能匹配源和目标属性
        //        MatchingStrategies.LOOSE	松散匹配源属性和目标属性
        //        MatchingStrategies.STRICT	严格匹配源和目标属性
        modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
    }

    public static ModelMapper Instance() {
        return modelMapperSingle.modelMapper;
    }
}
